package acceptTests;

import java.io.IOException;

import exceptions.database.InvalidUserListException;
import exceptions.database.NonAssessableDatabaseException;
import sessionManager.SessionManager;
import sessionManager.SessionManagerIF;
import user.UserIF;
import user.profile.ProfileFacade;

public class US03Facade {

	private SessionManagerIF session = SessionManager.getInstance();

	public String logon(String login, String password) throws Exception {
		return session.loginUser(login, password);
	}

	public void createProfile(String login, String senha, String nome_exibicao,
			String email, String sexo, String dataNasc, String endereco,
			String interesses, String quem_sou_eu, String filmes,
			String musicas, String livros) throws Exception {

		session.createUser(login, senha, nome_exibicao, email, sexo, dataNasc,
				endereco, interesses, quem_sou_eu, filmes, musicas, livros);

	}

	public void loadData() throws NonAssessableDatabaseException {

		session.loadData();

	}

	public void changeProfileInformation(String idSession, String atributo,
			String valor) throws Exception {
		UserIF u = session.getUser(idSession);
		ProfileFacade pf = new ProfileFacade(u.getProfile());
		pf.changeProfileInformation(atributo, valor);
		

	}

	public String getProfileInformationBySessionId(String idSession, String atributo)
			throws Exception {
		UserIF u = session.getUser(idSession);
		ProfileFacade pf = new ProfileFacade(u.getProfile());
		
		return pf.getProfileInformation(atributo);
	}

	public void saveData() throws InvalidUserListException, IOException {
		session.saveData();
	}

	public void logoff(String idSession) throws Exception {
		session.logoffUser(idSession);
	}
}
